# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-sflock
pkgname=('python2-sflock' 'python-sflock')
pkgver=0.3.10
pkgrel=10
pkgdesc='Sample staging and detonation utility.'
arch=('any')
url='https://pypi.org/project/SFlock/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/SFlock-0.3.10.tar.gz"
        'setup.py.patch')
sha512sums=('055b60a23103c1662cfd62aef37a2c2bfbfc0cc2fa5982736bd58b8e4a4fb73f5450b11c3e3ef3802871e3ce11b75a1b03f309ae17191ce407b2fd6c89e24111'
            '1901f8c691b0634a459effb21b899d6eb9499afdf972daac2056fc6ec784e4f1849d2218f41bac2d235a09521d2871e0ce32c1365502a31fcbafe855b24ab687')

prepare() {
  patch -p1 < setup.py.patch

  cp -a "SFlock-$pkgver" "SFlock2-$pkgver"
}

build() {
  cd "SFlock-$pkgver"

  python setup.py build

  cd "$srcdir/SFlock2-$pkgver"

  python2 setup.py build
}

package_python2-sflock() {
  depends=('python2' 'python2-click' 'python2-olefile' 'python2-python-magic'
           'python2-cryptography' 'peepdf')

  cd "SFlock2-$pkgver"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/sflock" "$pkgdir/usr/bin/sflock2"
}

package_python-sflock() {
  depends=('python' 'python-click' 'python-olefile' 'python-python-magic'
           'python-cryptography' 'peepdf')

  cd "SFlock-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

